import 'package:flutter/material.dart';

class Button extends StatefulWidget {
  String name;
  VoidCallback callback;
  Button({Key key, this.name = "登录",this.callback}) : super(key: key);

  @override
  _ButtonState createState() => _ButtonState(this.name,this.callback);
}

class _ButtonState extends State<Button> {
  String _name;
  VoidCallback _callback;
  _ButtonState(name,callback) {
    this._name = name;
    this._callback = callback;
  }

  @override
  Widget build(BuildContext context) {
    return ButtonTheme(
        height: 50,
        textTheme: ButtonTextTheme.primary,
        child: SizedBox(
          width: double.infinity,
          child: RaisedButton(
            child: Text(this._name),
            onPressed: () {
              print(this._name);
              this._callback();
            },
          ),
        ));
  }
}
